package br.com.cadele.beans;

/** Exemplos
 *** Exemplo de multiplos mapeamentos e passagem de parametros
 *
 *@URLMappings(mappings = {
		@URLMapping(id = "createAmostra", pattern = "/amostra/create", viewId = "/pages/amostra/createAmostra.xhtml"),
		@URLMapping(id = "changeAmostra", pattern = "/amostra/change/#{id : createAmostraBean.id}", viewId = "/pages/amostra/createAmostra.xhtml"),
		@URLMapping(id = "removeAmostra", pattern = "/amostra/remove/#{id : createAmostraBean.id}", viewId = "/pages/amostra/createAmostra.xhtml"),
		@URLMapping(id = "visualizeAmostra", pattern = "/amostra/visualize/#{id : createAmostraBean.id}", viewId = "/pages/amostra/createAmostra.xhtml") })
		
 */

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Aluno;
import br.com.cadele.service.AlunoService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@ManagedBean(name="cadastrarAlunoBean")
@URLBeanName(value="cadastrarAlunoBean")
@ViewScoped
@URLMapping(id="cadastrarAlunoBean", pattern="/aluno/cadastrar", viewId = "/pages/aluno/cadastrar.xhtml")
public class CadastrarAlunoBean implements Serializable{
	
	private static final long serialVersionUID = 8334944690404188026L;
	private Aluno aluno;
	private AlunoService alunoService;

	@PostConstruct
	public void init(){
		aluno = new Aluno();
		alunoService = new AlunoService();
	}
	
	public void salvar() {
		alunoService.executeInsert(aluno);
	}

	public Aluno getAluno() {
		return aluno;
	}

	public void setAluno(Aluno aluno) {
		this.aluno = aluno;
	}
	
}
